// Copyright 2022 jeff.li. and/or its affiliates.

#include <tbir/runtime/unicodelib/unicode_normal_form.h>

namespace tbir::runtime::UnicodeNormalForm {


    TURBO_EXPORT int32_t FromStr(string_view form) noexcept {
        if (form == "NFC") {
            return NFC;
        }
        if (form == "NFKC") {
            return NFKC;
        }
        if (form == "NFD") {
            return NFD;
        }
        if (form == "NFKD") {
            return NFKD;
        }
        return Invalid;
    }

    TURBO_EXPORT string_view ToStr(int32_t form) noexcept {
        switch (form) {
            case NFC: {
                return "NFC";
            }
                break;
            case NFKC: {
                return "NFKC";
            }
                break;
            case NFD: {
                return "NFD";
            }
                break;
            case NFKD: {
                return "NFKD";
            }
                break;
            default: {
                return "Invalid";
            }
                break;
        }
    }

}  // namespace tbir::runtime::UnicodeNormalForm
